package java19_5_9.com.huweilong.io.write_file;

import java.io.*;

/**
 * @author 是阿秋啊
 * @date 2022/05/09 20:23
 **/
public class writeText {
    public static void main(String[] args) throws IOException {
        try (OutputStream os = new FileOutputStream("world2.txt")){
            try(Writer writer = new OutputStreamWriter(os,"UTF-8")) {
                try(PrintWriter printWriter = new PrintWriter(writer)) {
                    printWriter.println("你好中国！");
                    printWriter.print("你好世界！");
                    printWriter.printf("%s %d","加油",1223);
                    printWriter.flush();
                }
            }
        }
    }
}
